using System;
using System.Runtime.InteropServices;
namespace System.Windows.Controls
{
	internal static class NumericExtensions
	{
		[StructLayout(LayoutKind.Explicit)]
		private struct NanUnion
		{
			[FieldOffset(0)]
			internal double FloatingValue;
			[FieldOffset(0)]
			internal ulong IntegerValue;
		}
		public static bool IsNaN(this double value)
		{
			NumericExtensions.NanUnion nanUnion = new NumericExtensions.NanUnion
			{
				FloatingValue = value
			};
			ulong num = nanUnion.IntegerValue & 18442240474082181120uL;
			if (num != 9218868437227405312uL && num != 18442240474082181120uL)
			{
				return false;
			}
			ulong num2 = nanUnion.IntegerValue & 4503599627370495uL;
			return num2 != 0uL;
		}
		public static bool IsGreaterThan(double left, double right)
		{
			return left > right && !NumericExtensions.AreClose(left, right);
		}
		public static bool AreClose(double left, double right)
		{
			if (left == right)
			{
				return true;
			}
			double num = (Math.Abs(left) + Math.Abs(right) + 10.0) * 2.2204460492503131E-16;
			double num2 = left - right;
			return -num < num2 && num > num2;
		}
	}
}
